<%@ page import="cn.edu.lingnan.service.IStudentService" %>
<%@ page import="cn.edu.lingnan.service.IParticipationService" %>
<%@ page import="cn.edu.lingnan.pojo.Participation" %>
<%@ page import="java.util.List" %>
<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8"%>

<%
    int sid = (int)session.getAttribute("sid");
    IParticipationService service = new IParticipationService();
    List<Participation> participationList = service.findParticipationBySid(sid);
%>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" type="text/css" href="../css/viewGrades.css">
    <title>个人竞赛记录</title>

</head>
<header>
    <h1>个人竞赛记录</h1>
    <hr>
</header>
<body>
<div style="display: flex; align-items: center; margin-bottom: 20px;">
    <a href="/loginOut" class="link-style">注销</a>
    <a href="/main.jsp" class="link-style">返回首页</a></div>
<div class="container">

    <table>
        <tr>
            <th>项目名称</th>
            <th>分数</th>
            <th>排名</th>
        </tr>
        <%
            if(participationList != null && !participationList.isEmpty()){
                for (Participation part : participationList) {
                    if(part.getStatus()==1){
        %>
        <tr>
            <td><%= part.getCompetition_name() %></td>
            <td><%= part.getScore() %></td>
            <td><%= part.getCompetition_rank() %></td>
        </tr>
        <%
                }
            }
        }else {
        %>
    </table>
    <div class="empty-message">
        <img src="/images/entry2.png" alt="空空如也">
        <p>暂无记录</p>
    </div>
    <%
        }
    %>
</div>
</body>
</html>